app.config(function ($routeProvider) {
    $routeProvider
        .when('/', {
            controller: 'ListController',
            templateUrl: 'template/list.htm',
            resolve: {
                auth: auth
            }
        })
        .when('/user/', {
            controller: 'UserControllerB',
            templateUrl: 'template/user.htm',
            resolve: {
                auth: auth
            }
        }).otherwise({
        redirectTo: '/'
    });
}).run(
    function ($rootScope, $location) {
        $rootScope.$on('$routeChangeSuccess', function (userInfo) {
        });

        $rootScope.$on('$routeChangeError', function (event, current,
                                                      previous, eventObj) {
            if (eventObj.authenticated == false) {
                $location.path('/login');
            }
        });
    });